//
//  TextAndImageView.m
//  wangzhe
//
//  Created by 李 佳伟 on 2017/10/11.
//  Copyright © 2017年 李 佳伟. All rights reserved.
//

#import "TextAndImageView.h"
#import "JTCSM.h"

@implementation TextAndImageView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (id)initWithFrame:(CGRect)frame withImagename:(NSString *)imagename text:(NSString *)text{
    self = [super initWithFrame:frame];
    if (self) {
        CGFloat Hegiht = frame.size.height-5;
        CGFloat Width = frame.size.width;
        CGFloat imagesize = 15;
        self.heardImageV = [[UIImageView alloc]initWithFrame:CGRectMake(0, (Hegiht-imagesize)/2, (imagename==nil)?0:imagesize, imagesize)];
        self.heardImageV.image = [UIImage imageNamed:imagename];
        [self addSubview:self.heardImageV];
        
        self.textField = [UITextField initWithframe:CGRectMake(KVIEW_X(self.heardImageV)+10, 0, Width-10-imagesize, Hegiht) backgrandColor:nil placeholder:text textAlignment:NSTextAlignmentLeft font:18 texcolor:[UIColor blackColor]];
        [self addSubview: self.textField];
        
        [df lineViewWithHeightofTop:Hegiht+5 superView:self spacing:0 color:RGBACOLOR(241, 241, 241, 1) lineHeight:1.5];
    }
    return self;
}

@end
